import Vue from 'vue'
import { login } from "@/api/user";
import {title} from '@/config'

const state=()=>({

})

const getters={

}

const mutations={

}

const actions={
  async login({commit},userInfo){
    console.log({commit},userInfo)
    const {data } = await login(userInfo)
    console.log(data);
    console.log(data.data);
    window.localStorage.setItem("user", JSON.stringify(data.data));
    const hour = new Date().getHours()
    const thisTime =
    hour<8 ?'早上好':hour<=11 ?'上午好':hour<=13?'中午好':hour<18?'下午好':'晚上好';
    Vue.prototype.$baseNotify(`欢迎登陆${title}`,`${thisTime}`)
  }
}

export default {state,mutations,getters,actions}